home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / os2tg_10.zip / SIO153.ZIP / SIOREF.TXT < prev    next >
Text File  |  1995-08-16  |  83KB  |  2,056 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.                                        SIO
  26.                            Technical Reference Manual
  27.  
  28.  
  29.  
  30.                      Copyright (c) 1995 by Raymond L. Gwinn
  31.                                 26 Tanager Place
  32.                           Beckley, West Virginia 25801
  33.                                All Rights Reserved
  34.  
  35.                                  August 10, 1995
  36.  
  37.  
  38.                               CompuServe: 71154,575
  39.                              InterNet: ray@gwinn.com
  40.                               Voice: 1-304-255-7900
  41.                                FAX: 1-303-255-7902
  42.                       BBS: 1-304-255-7903 or 199.248.240.2
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.                                   INTRODUCTION
  66.  
  67.      Documentation of software is often more difficult than writing the
  68.      program itself (at least it is for this author).  I will do my best
  69.      though.
  70.  
  71.      But who do I document for?  The user that is setting up a BBS just
  72.      wants to get SIO installed and to move on to more important things. 
  73.      The user that is having problems needs information about serial I/O
  74.      communications in general and the PC specifically.  The application
  75.      developer (programmer) needs detailed information about each
  76.      individual function and the information generated.
  77.  
  78.      The answer is, more than one manual is needed.  This manual is
  79.      intended as a reference for use by application programmers that
  80.      desires to use SIO.  A separate Users Manual is included in the
  81.      distribution file(s).
  82.  
  83.      This manual and the software described is provided as is and with no
  84.      guarantees.  Use at your own risk.
  85.  
  86.  
  87.  
  88.  
  89.      ii
  90.  
  91.  
  92.      WHAT IS SIO . . . . . . . . . . . . . . . . . . . . . . . . . . .    1
  93.  
  94.      DISTRIBUTION, ORDERING AND SUPPORT  . . . . . . . . . . . . . . .    2
  95.           Distribution and Ordering  . . . . . . . . . . . . . . . . .    2
  96.                SIO Distribution and Support BBS  . . . . . . . . . . .    2
  97.            . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    2
  98.                OS/2 Vendor Forum on
  99.                     CompuServe . . . . . . . . . . . . . . . . . . . .    2
  100.           Updates  . . . . . . . . . . . . . . . . . . . . . . . . . .    3
  101.  
  102.      Development and Debugging Tools . . . . . . . . . . . . . . . . .    4
  103.           The Poor Man's Line Monitor (PMLM.EXE) . . . . . . . . . . .    4
  104.           VIEWPMLM.EXE . . . . . . . . . . . . . . . . . . . . . . . .    5
  105.           SIO's Utility (SU.EXE) . . . . . . . . . . . . . . . . . . .    5
  106.                IRQs that currently free for use  . . . . . . . . . . .    5
  107.  
  108.      File System Requests  . . . . . . . . . . . . . . . . . . . . . .    6
  109.           Driver Initialization  . . . . . . . . . . . . . . . . . . .    6
  110.           Read . . . . . . . . . . . . . . . . . . . . . . . . . . . .    6
  111.           Input Status . . . . . . . . . . . . . . . . . . . . . . . .    6
  112.           Input Flush  . . . . . . . . . . . . . . . . . . . . . . . .    7
  113.           Write  . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  114.           Output Status  . . . . . . . . . . . . . . . . . . . . . . .    7
  115.           Output Flush . . . . . . . . . . . . . . . . . . . . . . . .    7
  116.           Open . . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  117.                Initial Open  . . . . . . . . . . . . . . . . . . . . .    7
  118.                Additional Open . . . . . . . . . . . . . . . . . . . .    8
  119.           Close  . . . . . . . . . . . . . . . . . . . . . . . . . . .    8
  120.                Intermediate Close  . . . . . . . . . . . . . . . . . .    8
  121.                Last Close  . . . . . . . . . . . . . . . . . . . . . .    8
  122.  
  123.      Device I/O Control (IOCtl) Commands . . . . . . . . . . . . . . .    9
  124.           IOCtl Functions From a DOS Session . . . . . . . . . . . . .   10
  125.           41h - Set Bit Rate . . . . . . . . . . . . . . . . . . . . .   11
  126.           42h - Set Line Characteristics . . . . . . . . . . . . . . .   12
  127.           43h - Extended Set Bit Rate  . . . . . . . . . . . . . . . .   13
  128.           44h - Transmit Byte Immediate  . . . . . . . . . . . . . . .   14
  129.           45h - Set Break Off  . . . . . . . . . . . . . . . . . . . .   14
  130.           46h - Set Modem Control Signals  . . . . . . . . . . . . . .   15
  131.           47h - Hold Transmit  . . . . . . . . . . . . . . . . . . . .   16
  132.           48h - Start Transmit . . . . . . . . . . . . . . . . . . . .   16
  133.           4Bh - Set Break on . . . . . . . . . . . . . . . . . . . . .   17
  134.           53h - Write Device Control Block (DCB)   . . . . . . . . . .   17
  135.           54h - Write Extended Mode Parameters . . . . . . . . . . . .   20
  136.           61h - Query Current Bit Rate . . . . . . . . . . . . . . . .   21
  137.           62h - Query Line Characteristics . . . . . . . . . . . . . .   21
  138.           63h - Query Extended Bit Rate  . . . . . . . . . . . . . . .   22
  139.           64h - Query SIO Status . . . . . . . . . . . . . . . . . . .   23
  140.           65h - Query Transmit Data Status . . . . . . . . . . . . . .   24
  141.           66h - Query Current Modem Output Control Signals . . . . . .   25
  142.           67h - Query Current Modem Input Signals  . . . . . . . . . .   25
  143.           68h - Query Number of Characters in Receive Buffer . . . . .   26
  144.           6Dh - Query SIO Error  . . . . . . . . . . . . . . . . . . .   27
  145.           72h - Query SIO Event Information  . . . . . . . . . . . . .   28
  146.  
  147.  
  148.  
  149.  
  150.                                                                         iii
  151.  
  152.           73h - Read Device Control Block (DCB)  . . . . . . . . . . .   29
  153.           74h - Read Enhanced Mode Parameters  . . . . . . . . . . . .   29
  154.  
  155.      Differences between SIO/VSIO and COM/VCOM . . . . . . . . . . . .   30
  156.  
  157.      Appendix A, Hardware Port and IRQ Assignments . . . . . . . . . .   31
  158.           Addresses and IRQs for COM1 and COM2 . . . . . . . . . . . .   31
  159.           Defacto standard for COM3 and COM4 . . . . . . . . . . . . .   31
  160.           Addresses and IRQ for COM3 through COM8 on the PS/2  . . . .   31
  161.  
  162.      Appendix B, SIO Chips . . . . . . . . . . . . . . . . . . . . . .   32
  163.           8250 . . . . . . . . . . . . . . . . . . . . . . . . . . . .   32
  164.           8250A  . . . . . . . . . . . . . . . . . . . . . . . . . . .   32
  165.           16450  . . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  166.           16C451 . . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  167.           16550 (Non A)  . . . . . . . . . . . . . . . . . . . . . . .   33
  168.           16550A . . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  169.           16550AF  . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  170.           16550AFN . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  171.           16550s Made by Western Digital . . . . . . . . . . . . . . .   34
  172.           16C551 . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  173.           16C552 . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  174.           16C554 . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  175.           82510  . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  176.           16650  . . . . . . . . . . . . . . . . . . . . . . . . . . .   35
  177.           ComBic . . . . . . . . . . . . . . . . . . . . . . . . . . .   36
  178.  
  179.      Appendix C, Multi-Port Serial I/0 Cards . . . . . . . . . . . . .   37
  180.           STB 4COM . . . . . . . . . . . . . . . . . . . . . . . . . .   37
  181.           Gtek BBS550  . . . . . . . . . . . . . . . . . . . . . . . .   37
  182.           Neotech Quad Serial (MCA bus)  . . . . . . . . . . . . . . .   37
  183.  
  184.      Appendix D, Advanced SIO Options  . . . . . . . . . . . . . . . .   39
  185.           Protection . . . . . . . . . . . . . . . . . . . . . . . . .   39
  186.           Locked Baud Rate . . . . . . . . . . . . . . . . . . . . . .   39
  187.           IRQ Reflection to DOS Process  . . . . . . . . . . . . . . .   39
  188.           I/O Port Mapping to DOS Process  . . . . . . . . . . . . . .   39
  189.  
  190.      Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   40
  191.  
  192.  
  193.  
  194.  
  195.                                                                           1
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.                                    WHAT IS SIO
  214.  
  215.      SIO is a Serial Input/Output (SIO) communications character device
  216.      driver.  It provides an interface between application programs and the
  217.      serial communications hardware.
  218.  
  219.      SIO had been designed as a high performance replacement for the OS/2
  220.      device driver COM.SYS.  This manual documents the known differences
  221.      between COM.SYS and SIO.SYS.
  222.  
  223.      SIO only works with 8250 (type) serial I/O devices.  Such devices
  224.      include, but is not limited to the 8250A, 16450, 16550, 16550A and the
  225.      82510.  If you have a PC that is an IBM or near compatible which has a
  226.      serial communication port, it is likely that it contains one of these
  227.      devices.  SIO will identify the type of serial devices that it finds
  228.      at load time.
  229.  
  230.      Like other Device Drivers, SIO will do very little standing alone. 
  231.      There must be an application(s) program that makes use of SIO's
  232.      functions before one will benefit from the use of SIO.
  233.  
  234.  
  235.  
  236.  
  237.      2
  238.  
  239.                        DISTRIBUTION, ORDERING AND SUPPORT
  240.  
  241.      Distribution and Ordering
  242.  
  243.      The entire package collectively known as SIO is ShareWare.  It is not
  244.      free software or freeware.  See LICENSE.TXT and ORDER.TXT for
  245.      additional information.  The ShareWare version of SIO is distributed
  246.      electronically.  One may check their favorite electronic hangout for
  247.      the latest version of SIO.  The latest copy of the ShareWare version
  248.      is always posted for downloading from the BBS at 1-304-255-7903 or
  249.      199.248.240.2.
  250.  
  251.      Registered versions of SIO are distributed by US Mail and
  252.      electronically from the SIO Distribution and Support BBS.  Users
  253.      desiring to register electronically, may call the BBS and register on
  254.      line (1-304-255-7903 or 199.248.240.2) and immediately download their
  255.      registered version of SIO.  Use the ORDER command at the main BBS
  256.      prompt.
  257.  
  258.      Registrations/Orders can also be placed by phone, mail, FAX, and
  259.      email.  See the front cover of this manual for the phone numbers and
  260.      addresses.  Also see ORDER.TXT for and order form that may be used.
  261.  
  262.      Support
  263.      Extensive testing has been done to insure that this product works on
  264.      the widest possible range of OS/2 V2 (and up) systems.  In most cases,
  265.      problems can be resolved by reading this manual carefully.
  266.  
  267.      Support is provided in section 4 of the OS/2 Vendor Forum on
  268.      CompuServe (GO OS2BVEN).  Section 4 of the OS2BVEN Forum is dedicated
  269.      to the support of SIO.
  270.  
  271.      In addition, support is provided by BBS, Email and FAX.  Voice support
  272.      would overwhelm the author and is not available.  If, after reading
  273.      the manual carefully, you are unable to resolve a problem, you may
  274.      submit a problem report to one of the following: 
  275.                                       Email
  276.                               CompuServe 71154,575
  277.                              Internet ray@gwinn.com
  278.                                FAX 1-304-255-7902
  279.                        BBS 1-304-255-7903 or 199.248.240.2
  280.  
  281.      Users should note that Support does not always result in a correction
  282.      of a problem.  In addition, the support provided is support of SIO,
  283.      and not the applications that use SIO.  Questions and/or problems
  284.      about applications programs (such as terminal or FAX programs) should
  285.      be directed to the available support for the application.
  286.  
  287.  
  288.  
  289.  
  290.                                                                           3
  291.  
  292.  
  293.      Updates
  294.  
  295.      In general, updates/upgrades of SIO are free of charge for all
  296.      releases of SIO with the same major version number.  However, there
  297.      may be a handling charge if the user requires the upgrade to be mailed
  298.      or emailed.
  299.  
  300.      Registered users of SIO can update to the latest version FREE of
  301.      charge using the BBS and its UPDATE command.  Be sure to have your SIO
  302.      serial number when you first log onto the BBS.  All variations (number
  303.      of ports) of SIO are available for immediate download from the BBS by
  304.      registered users.
  305.  
  306.      Users that have a registered copy of SIO can also use REREG.EXE to
  307.      transfer the registration information to a new version of SIO.  Simply
  308.      unzip the new SIO files into a temporary directory, change to that
  309.      directory, execute REREG and answer the questions.  After doing the
  310.      above, all of the files in the temporary directory will have been
  311.      registered.  You must then copy all the SYS and EXE files from the
  312.      temporary directory to their normal directory (overlaying the old
  313.      registered version) or execute the SIO install program (INSTALL.EXE). 
  314.      Then you must reboot.  You may also want to check your CONFIG.SYS for
  315.      the path of the SIO/VSIO being loaded and make sure both the new ones
  316.      are being loaded.
  317.  
  318.      If REREG will not transfer your registration information from a
  319.      previous version of SIO to the new version, then an upgrade must be
  320.      ordered on disk or obtained from the support BBS.
  321.  
  322.  
  323.  
  324.  
  325.      4
  326.  
  327.                          Development and Debugging Tools
  328.  
  329.      The Poor Man's Line Monitor (PMLM.EXE)
  330.  
  331.      PMLM is basically of interest to developers of comm applications and
  332.      those providing technical support for those applications.  This SIO
  333.      utility is released largely (in self defense) in the hope that some
  334.      users can diagnose their own problems.  PMLM's feature of saving trace
  335.      information to disk will only work with registered and beta versions
  336.      of SIO.
  337.  
  338.      PMLM provides basic line monitoring for OS/2, DOS and Windows comm
  339.      programs.  All characters sent or received by application programs are
  340.      displayed in the upper portion of the screen.  Receive characters are
  341.      displayed as "white on blue" and transmitted characters are displayed
  342.      "yellow on violet".  Line signals, such as CTS are displayed as "dim
  343.      white on red" when turned off and "bright white on red" when turned
  344.      on.  In addition, a signals transition to OFF is displayed in lower
  345.      case and a signals transition to ON is displayed in upper case.
  346.  
  347.      Status information is displayed in the lower part of the screen.  A
  348.      bright white display means the signal is on, a dim white indicates
  349.      that the signal is off.  In addition, when bright,  Rxoff and Txoff
  350.      indicate the SIO has sent (Txoff) or received (Rxoff) an Xoff, and an
  351.      Xon is pending.
  352.  
  353.      When a DOS or Windows session uses a comm port, an additional line of
  354.      signal status appears.  This status line shows the state of the
  355.      virtual UART's signals.  Only the signals which MAY be different from
  356.      the real UART's signals are shown.
  357.  
  358.      "Rx Chars" and "Tx Chars" reflects the number of characters in SIO's
  359.      receive and transmit buffers respectively.
  360.  
  361.      The last line on the screen shows the keys (from the keyboard) that
  362.      PMLM will recognize.  The bright character shows the key to hit for
  363.      the associated function.  The font keys will not work in a windowed
  364.      OS/2 session.
  365.  
  366.      PMLM's command line requires one parameter, the comm port number, and
  367.      optionally accepts an additional parameter giving a save trace file
  368.      name.  For example, PMLM 1 COM1INFO.TEC will monitor COM1 and save ALL
  369.      of the communications traffic in the file COM1INFO.TRC.  The trace
  370.      files created by PMLM contain exactly the same information that is
  371.      displayed by PMLM, video attributes and all.
  372.  
  373.  
  374.  
  375.  
  376.                                                                           5
  377.  
  378.  
  379.      VIEWPMLM.EXE may be used to view trace files created by PMLM. 
  380.      VIEWPMLM.EXE requires one parameter, the trace file name.  The user
  381.      can use the keys UP, DOWN, PAGEUP, PAGEDOWN, HOME, and END to navigate
  382.      the saved trace file.  Registered SIO users may send VIEWPMLM.EXE
  383.      (along with saved trace files) to anyone for technical support
  384.      purposes.
  385.  
  386.      VIEWPMLM can be used in native DOS, in DOS sessions under OS/2, and in
  387.      OS/2 sessions.  This means that even those developers and support
  388.      people need not have OS/2 to view the captured communications data
  389.      created by PMLM.
  390.  
  391.      SIO's Utility (SU.EXE)
  392.  
  393.      This utility program has several useful commands.  You can obtain a
  394.      list of the available commands by typing SU at any command line prompt
  395.      without any parameters.  One very useful command is SU IRQS.  This
  396.      command will show IRQs that currently free for use.  Commands are
  397.      provided allowing user control (missing from MODE) are available. 
  398.      Status commands provide a wealth of diagnostic information.
  399.  
  400.  
  401.  
  402.  
  403.      6
  404.  
  405.                               File System Requests
  406.  
  407.      SIO processes all file system requests made to it in one way or
  408.      another.  The following file system requests and how SIO processes
  409.      them may be of use to the application programmer.
  410.  
  411.      INIT           Driver initialization.
  412.      Read           Data transfer from driver to program.
  413.      Input Status   Get input status.
  414.      Input Flush    Terminate all pending input requests.
  415.      Write          Data transfer from program to driver.
  416.      Output Status  Get output status.
  417.      Output Flush   Terminate all pending output requests.
  418.      Open           Open the device for use.
  419.      Close          Close the device.
  420.      IOCTL          Device I/O control commands.
  421.  
  422.      Each of these file system requests are discussed in more detail in the
  423.      following.
  424.  
  425.                               Driver Initialization
  426.  
  427.      During device driver initialization the command line is parsed, memory
  428.      for data and control buffers is allocated and the system environment
  429.      is examined.
  430.  
  431.      Buffers are allocated for the maximum number of ports that the
  432.      installed version of SIO can support (up to 16).
  433.  
  434.      The mouse port is determined and if it is a serial mouse, that port is
  435.      excluded from use by SIO.
  436.  
  437.      In the absence of any command line parameters, SIO will only support
  438.      (look for) COM1 and COM2 at the standard addresses.  COM3 and up will
  439.      not be supported (or looked at) unless they are specifically
  440.      identified in the SIO command line.
  441.  
  442.                                       Read
  443.  
  444.      If another read is already in progress, the process issuing the
  445.      additional read is blocked (suspended) until the previous read command
  446.      completes.  When a read is started, that read is not interrupted by
  447.      additional reads.  If multiple reads are issued, they are not
  448.      necessarily processed in the order they were issued.  Thus,
  449.      applications may not see the read requests complete in the order in
  450.      which they were issued.
  451.  
  452.      The conditions that control when the read will complete are controlled
  453.      by the active (current) DCB when the read is started.
  454.  
  455.                                   Input Status
  456.  
  457.      This function returns with "device busy" set if there is no data in
  458.      the receive buffer.  That is, busy is returned if the process may be
  459.      blocked if the application issues a read command.
  460.  
  461.  
  462.  
  463.  
  464.                                                                           7
  465.  
  466.                                    Input Flush
  467.  
  468.      This function causes the receive buffer to be cleared (made empty). 
  469.      Any threads that are blocked, waiting for a read, will be restarted
  470.      when this function is issued.
  471.  
  472.  
  473.                                       Write
  474.  
  475.      If another write is already in progress, the process issuing the
  476.      additional write is blocked (suspended) until the previous write
  477.      command completes.  When a write is started, that write is not
  478.      interrupted by additional writes.  If multiple writes are issued, they
  479.      are not necessarily processed in the order they were issued.  Thus,
  480.      applications may not see the write requests complete in the order in
  481.      which they were issued.
  482.  
  483.      The conditions that control when the write will complete are
  484.      controlled by the current DCB when the write is started.
  485.  
  486.  
  487.                                   Output Status
  488.  
  489.      This function returns with "device busy" set if the output buffer is
  490.      more than three quarters full.  That is, busy is returned if the
  491.      process may be blocked if the application issues a write command.
  492.  
  493.                                   Output Flush
  494.  
  495.      This function causes the transmit buffer to be cleared (made empty). 
  496.      Any threads that are blocked, waiting for a write, will be restarted
  497.      when this function is issued.
  498.  
  499.  
  500.                                       Open
  501.  
  502.      There are basically two kinds of open.  They are an Initial Open and
  503.      Additional (shared) Opens. The IBM documentation calls the initial
  504.      open a First Level Open.  An Initial Open is an open that occurs when
  505.      no other process has the communications port open.  An Additional Open
  506.      is when an open occurs and another process already has the
  507.      communications port open.  For an Additional Open to occur, the
  508.      Initial Opener must have issued an open allowing shared access to the
  509.      port.
  510.  
  511.      Initial Open
  512.  
  513.      The IRQ associated with the comm port is claimed (taken) when the
  514.      Initial Open occurs.  If the associated IRQ is not available a "Port
  515.      in Use" error is returned.  At the time of this writing, the IRQ is
  516.      claimed allowing sharing.  However, the shared IRQ claiming is done to
  517.      circumvent anomalies in the OS, and in actuality SIO will not
  518.      concurrently share an IRQ with another device driver.  The author
  519.      found it necessary to claim (reset) all interrupts directed to the
  520.      interrupt service routine in order to prevent lock ups of a
  521.  
  522.  
  523.  
  524.  
  525.      8
  526.  
  527.      communications port.  The IRQ mess may be cleaned up at a future date
  528.      when the OS problems are corrected.
  529.  
  530.      During Initial Opens, DTR and RTS are set in accordance with the
  531.      current Device Control Block (DCB) settings.  If DTR Control Mode is
  532.      the "Enabled" option ( bits 1 and 0 of the DCB Flags1 byte equal 01),
  533.      then DTR is turned on.  Otherwise, DTR is unchanged by the Initial
  534.      Open.  Similarly, if RTS Control Mode is the "Enabled" option ( bits 7
  535.      and 6 of the DCB Flags1 byte equal 01), then RTS is turned on. 
  536.      Otherwise, RTS is unchanged by the Initial Open.
  537.  
  538.      The following actions also occur during an Initial Open:
  539.  
  540.           The Xon and Xoff characters are set to 11h and 13h respectively.
  541.  
  542.           The transmit and receive buffers and structures are cleared and
  543.           re-initialized.
  544.  
  545.           Status bits are reset.
  546.  
  547.      If the Initial Opener is an OS/2 process (not a DOS process) then the
  548.      Read time out processing is set to "Normal" in the current DCB.
  549.  
  550.      Additional Open
  551.  
  552.      A count of active opens is incremented.  No changes are made to
  553.      current comm settings.
  554.  
  555.                                       Close
  556.  
  557.      There are two basic kinds of closes.  They are an Intermediate Close
  558.      and a Last Close.
  559.  
  560.      Intermediate Close
  561.  
  562.      An intermediate close occurs when a process issues a close and other
  563.      processes still have the communications port opened.  This type of
  564.      close simply decrements an open count and returns.  No action or
  565.      changes take place at the communications port.
  566.  
  567.      Last Close
  568.  
  569.      The last close occurs when a process issues a close and no other
  570.      process has the communications port open.  If there are any writes
  571.      pending or incomplete, the process is blocked (suspended) until the
  572.      writes complete or time out.  If 60 seconds pass with no activity at
  573.      the communications port, the port is forced to close and all writes
  574.      are terminated.  If any processes are blocked (suspended) waiting on a
  575.      read, they are forced to return to the process that issued the read.
  576.  
  577.      If either DTR Control Mode or RTS Control Mode are set to "Enabled" by
  578.      the current DCB, then the appropriate signal(s) is turned off.
  579.  
  580.      Finally, the IRQ is released back to the OS.
  581.  
  582.  
  583.  
  584.  
  585.                                                                           9
  586.  
  587.                        Device I/O Control (IOCtl) Commands
  588.  
  589.      The following Generic IOCtl functions are supported by SIO.
  590.           41h - Set Bit Rate
  591.           42h - Set Line Characteristics
  592.           43h - Extended Set Bit Rate
  593.           44h - Transmit Byte Immediate
  594.           45h - Set Break Off
  595.           46h - Set Modem Control Signals
  596.           47h - Hold Transmit
  597.           48h - Start Transmit (after hold)
  598.           4Bh - Set Break On
  599.           53h - Write Device Control Block (DCB) 
  600.           54h - Write Extended Mode Parameters
  601.           61h - Query Current Bit Rate
  602.           62h - Query Line Characteristics
  603.           63h - Query Extended Bit Rate
  604.           64h - Query SIO Status
  605.           65h - Query Transmit Data Status
  606.           66h - Query Current Modem Output Control Signals
  607.           67h - Query Current Modem Input Signals
  608.           68h - Query Number of Characters in Receive Buffer
  609.           69h - Query Number of Characters in Transmit Buffer
  610.           6Dh - Query SIO Error
  611.           72h - Query SIO Event Information
  612.           73h - Read Device Control Block (DCB)
  613.           74h - Read Enhanced Mode Parameters
  614.  
  615.      Each of these IOCtl commands are described in detail on the following
  616.      pages.
  617.  
  618.  
  619.  
  620.  
  621.      10
  622.  
  623.  
  624.      All IOCtl functions are called with a uniform set of parameters.  This
  625.      uniform set of parameters is:
  626.           DWORD     Address of a data packet.
  627.           WORD      Size of the data packet in bytes.
  628.           DWORD     Address of the parameter packet.
  629.           WORD      Size of the parameter packet in bytes.
  630.           WORD      Function code.
  631.           WORD      Category code (01 for SIO).
  632.           WORD      Handle for the opened device. 
  633.  
  634.      Each IOCtl function may or may not have a data or parameter packet. 
  635.      If a given IOCtl function specifies a NULL parameter or data packet,
  636.      the address of the appropriate item must be NULL (zero) in the
  637.      parameters.  Passing an invalid data or parameter packet may result in
  638.      a General Protection Fault.
  639.  
  640.      IOCtl Functions From a DOS Session
  641.  
  642.      Additionally the following describes how to call an IOCtl function in
  643.      an OS/2 driver from a DOS session (VDM).  The "handle" is obtained
  644.      simply by issuing a normal DOS open of the device, ie COM1.  The Data
  645.      Packets (DataPkt below) and Parameter Packets (PrmPkt below) are
  646.      different for each IOCtl function.  The structure and contents of
  647.      these packets are described in the following pages.
  648.  
  649.              push    ds              ;save ds
  650.              mov     bx,handle       ;file handle to bx
  651.              mov     ch,1            ;category, 1=serial device control
  652.              mov     cl,41h          ;func code, 41h=extended set bit rate
  653.              mov     dx,Seg DataPkt  ;get segment of the data packet
  654.              mov     ds,dx           ;load ds with seg of the data packet
  655.              lea     dx,DataPkt      ;data packet address to ds:dx
  656.              mov     si,Seg PrmPkt   ;segment of command packet to si
  657.              lea     di,PrmPkt       ;offset of command packet to di
  658.              mov     ax,440ch        ;IOCtl function call, handle based
  659.              int     21h             ;issue IOCtl to OS/2 driver.
  660.              pop     ds              ;restore ds
  661.              jc      error           ;jump if error returned
  662.  
  663.  
  664.  
  665.  
  666.                                                                          11
  667.  
  668.  
  669.                                41h - Set Bit Rate
  670.  
  671.      Parameter Packet
  672.  
  673.           ┌──────────────────────────────────────┐
  674.           │         Item                Type     │
  675.           ├───────────────────────────┬──────────┤
  676.           │ Bit/Baud Rate             │ WORD     │
  677.           └───────────────────────────┴──────────┘
  678.  
  679.           "Bit Rate" is any number from 1 to 65535.  SIO does not attempt
  680.           to validate a given bit rate.  The minimum bit rate accepted by
  681.           SIO is 50, the maximum for this IOCtl function is 65535.
  682.  
  683.           Note that the hardware may not be able to generate the given bit
  684.           rate.  For example, if a computer has a standard communications
  685.           card installed and if a bit rate of 65500 is specified, the
  686.           nearest bit rate that can be generated will be set, 57600 in this
  687.           case.
  688.  
  689.           To set bit rates in excess of 57600, see IOCtl function 43h,
  690.           Extended Set Bit Rate.
  691.  
  692.           Some commonly used bit rates that can be set with this function
  693.           are:
  694.  
  695.           50        2000
  696.           75        2400
  697.           110       3600
  698.           150       4800
  699.           300       7200
  700.           600       9600
  701.           1200      19200
  702.           1800      28800
  703.           2000      38400
  704.           2400      57600
  705.  
  706.  
  707.      Data Packet - None
  708.  
  709.  
  710.  
  711.  
  712.      12
  713.  
  714.  
  715.                          42h - Set Line Characteristics
  716.  
  717.      Parameter Packet
  718.  
  719.           ┌──────────────────────────────────────┐
  720.           │         Item                Type     │
  721.           ├───────────────────────────┬──────────┤
  722.           │ Data Bits Per Character   │ BYTE     │
  723.           ├───────────────────────────┼──────────┤
  724.           │ Parity Setting            │ BYTE     │
  725.           ├───────────────────────────┼──────────┤
  726.           │ Stop Bit Setting          │ BYTE     │
  727.           └───────────────────────────┴──────────┘
  728.  
  729.           Data Bits Per Character may be 5, 7, or 8, all other values are
  730.           invalid.
  731.  
  732.           Parity Setting may have the following values, all other values
  733.           are invalid:
  734.                0 - No parity bit.
  735.                1 - Odd parity.
  736.                2 - Even parity.
  737.                3 - Mark parity (1).
  738.                4 - Space parity (0).
  739.  
  740.  
  741.           Stop Bit Setting may have the following values, all other values
  742.           are invalid:
  743.                0 - 1 stop bit.
  744.                1 - 1.5 stop bit (valid with 5 data bit characters).
  745.                2 - 2 stop bits.
  746.  
  747.  
  748.      Data Packet - None
  749.  
  750.  
  751.  
  752.  
  753.                                                                          13
  754.  
  755.  
  756.                            43h - Extended Set Bit Rate
  757.  
  758.      Parameter Packet
  759.  
  760.           ┌──────────────────────────────────────┐
  761.           │         Item                Type     │
  762.           ├───────────────────────────┬──────────┤
  763.           │ Bit/Baud Rate             │ DWORD    │
  764.           ├───────────────────────────┼──────────┤
  765.           │ Fraction                  │ BYTE     │
  766.           └───────────────────────────┴──────────┘
  767.  
  768.  
  769.           "Bit Rate" is the desired bit/baud rate.  The maximum bit rate
  770.           supported by SIO is determined by the installed hardware. The
  771.           IOCtl function "63h - Query Extended Bit Rate" can be used to
  772.           determine the maximum bit rate allowed for the associated
  773.           hardware.
  774.  
  775.           SIO does not attempt to validate a given bit rate.  This means
  776.           that the hardware may not be able to generate the given bit rate. 
  777.           For example, if a computer has a standard communications card
  778.           installed and if a bit rate of 65500 is specified, the nearest
  779.           bit rate that can be generated will be set, 57600 in this case.
  780.  
  781.           "Fraction" is used to set the fractional part of the bit rate
  782.           when a high degree of accuracy is needed.  As of this writing,
  783.           SIO does not support a "Fraction" other than zero.
  784.  
  785.           Some commonly used bit rates that can be set with this function
  786.           are:
  787.  
  788.           110       3600      115200
  789.           150       4800      230400
  790.           300       7200
  791.           600       9600
  792.           1200      19200
  793.           1800      28800
  794.           2000      38400
  795.           2400      57600
  796.  
  797.      Data Packet - None
  798.  
  799.  
  800.  
  801.  
  802.      14
  803.  
  804.  
  805.                           44h - Transmit Byte Immediate
  806.  
  807.      Parameter Packet
  808.  
  809.           ┌──────────────────────────────────────┐
  810.           │         Item                Type     │
  811.           ├───────────────────────────┬──────────┤
  812.           │ Character to Transmit     │ BYTE     │
  813.           └───────────────────────────┴──────────┘
  814.  
  815.           "Character to Transmit" will be the next character loaded into
  816.           the UART for transmission.  If a previous transmit immediate byte
  817.           is still pending, it is lost.  This function does not wait for
  818.           the character to transmit before returning.
  819.  
  820.           This function may be used by an application program as one of a
  821.           set of functions to implement its own Xon/Xoff type handshaking.
  822.  
  823.      Data Packet - None
  824.  
  825.  
  826.                                45h - Set Break Off
  827.  
  828.      Parameter Packet - None
  829.  
  830.           Look!! No Parameter Packet!
  831.  
  832.      Data Packet
  833.  
  834.           ┌──────────────────────────────────────┐
  835.           │         Item                Type     │
  836.           ├───────────────────────────┬──────────┤
  837.           │ SIO Error Word            │ WORD     │
  838.           └───────────────────────────┴──────────┘
  839.  
  840.           See function 6Dh "Query SIO Error" for a description of the SIO
  841.           Error Word.  This function does not reset any bits in the SIO
  842.           Error Word.
  843.  
  844.  
  845.  
  846.  
  847.                                                                          15
  848.  
  849.  
  850.                          46h - Set Modem Control Signals
  851.  
  852.      Parameter Packet
  853.  
  854.           ┌──────────────────────────────────────┐
  855.           │         Item                Type     │
  856.           ├───────────────────────────┬──────────┤
  857.           │ DTR and RTS on mask       │ BYTE     │
  858.           ├───────────────────────────┼──────────┤
  859.           │ DTR and RTS off mask      │ BYTE     │
  860.           └───────────────────────────┴──────────┘
  861.  
  862.           Attempted changes in the the setting of signals that are used as
  863.           flow control signals are ignored.  The current DCB determines if
  864.           either or both RTS and DTR are used as a flow control signal.
  865.  
  866.           The setting of bit 0 affects DTR and the setting of bit 1 affects
  867.           RTS.  Ones in the "on mask" specifies which of the two signals
  868.           are to be turned on, and zeros in the "off mask" specify which of
  869.           the two signals are to be turned off.
  870.  
  871.           Some examples are:
  872.                On Mask        Off Mask
  873.                01h            0FFh      Turn DTR on
  874.                00h            0FEh      Turn DTR off
  875.                02h            0FFh      Turn RTS on
  876.                00h            0FDh      Turn RTS off
  877.                03h            0FFh      Turn RTS and DTR on
  878.                00h            0FCh      Turn RTS and DTR off
  879.  
  880.           If both on and off are specified for the setting of a signal, the
  881.           result is undefined.
  882.  
  883.      Data Packet
  884.  
  885.           ┌──────────────────────────────────────┐
  886.           │         Item                Type     │
  887.           ├───────────────────────────┬──────────┤
  888.           │ SIO Error Word            │ WORD     │
  889.           └───────────────────────────┴──────────┘
  890.  
  891.           See function 6Dh "Query SIO Error" for a description of the SIO
  892.           Error Word.  This function does not reset any bits in the SIO
  893.           Error Word.
  894.  
  895.  
  896.  
  897.  
  898.      16
  899.  
  900.  
  901.                                47h - Hold Transmit
  902.  
  903.      Parameter Packet - None
  904.  
  905.      Data Packet - None
  906.  
  907.           This function will disable the transmitter.  The transmitter will
  908.           not be enabled again unless IOCtl function 48h is issued.  If the
  909.           transmitter is already disabled, this call has no effect.
  910.  
  911.           This function can be used as part of a set that allows an
  912.           application to implement its own Xon/Xoff type handshaking.
  913.  
  914.           Note that this is different from how COM.SYS implements this
  915.           function.  COM.SYS will re-enable the transmitter if an Xon is
  916.           received while SIO will not.
  917.  
  918.  
  919.                               48h - Start Transmit
  920.  
  921.      Parameter Packet - None
  922.  
  923.      Data Packet - None
  924.  
  925.           This function will enable the transmitter, usually following an
  926.           IOCtl function 47h.  If the transmitter is already enabled, this
  927.           call has no effect.
  928.  
  929.           This function can be used as part of a set that allows an
  930.           application to implement its own Xon/Xoff type handshaking.
  931.  
  932.  
  933.  
  934.  
  935.                                                                          17
  936.  
  937.  
  938.                                4Bh - Set Break on
  939.  
  940.      Parameter Packet - None
  941.  
  942.           Look!! No Parameter Packet!
  943.  
  944.      Data Packet
  945.  
  946.           ┌──────────────────────────────────────┐
  947.           │         Item                Type     │
  948.           ├───────────────────────────┬──────────┤
  949.           │ SIO Error Word            │ WORD     │
  950.           └───────────────────────────┴──────────┘
  951.  
  952.           See function 6Dh "Query SIO Error" for a description of the SIO
  953.           Error Word.  This function does not reset any bits in the SIO
  954.           Error Word.
  955.  
  956.  
  957.                      53h - Write Device Control Block (DCB) 
  958.  
  959.      This is where the action is!  See also function 73h (Read DCB).
  960.  
  961.      Parameter Packet
  962.  
  963.           ┌──────────────────────────────────────┐
  964.           │         Item                Type     │
  965.           ├───────────────────────────┬──────────┤
  966.           │ Write Timeout             │ WORD     │
  967.           ├───────────────────────────┼──────────┤
  968.           │ Read Timeout              │ WORD     │
  969.           ├───────────────────────────┼──────────┤
  970.           │ Flags1                    │ BYTE     │
  971.           ├───────────────────────────┼──────────┤
  972.           │ Flags2                    │ BYTE     │
  973.           ├───────────────────────────┼──────────┤
  974.           │ Flags3                    │ BYTE     │
  975.           ├───────────────────────────┼──────────┤
  976.           │ Error Replacement Byte    │ BYTE     │
  977.           ├───────────────────────────┼──────────┤
  978.           │ Break Replacement Byte    │ BYTE     │
  979.           ├───────────────────────────┼──────────┤
  980.           │ Xon Character             │ BYTE     │
  981.           ├───────────────────────────┼──────────┤
  982.           │ Xoff Character            │ BYTE     │
  983.           └───────────────────────────┴──────────┘
  984.  
  985.  
  986.           "Write Timeout"  The write timeout is given in hundredths of a
  987.           second, relative to zero.  That is, 0 specifies 0.01 seconds and
  988.           1 specifies 0.02 seconds.
  989.  
  990.           "Read Timeout" The read timeout is given in hundredths of a
  991.           second, relative to zero.  That is, 0 specifies 0.01 seconds and
  992.  
  993.  
  994.  
  995.  
  996.      18
  997.  
  998.           1 specifies 0.02 seconds.
  999.  
  1000.           "Flags1" is a bit flag.  The bits in the flag specify the
  1001.           following:
  1002.  
  1003.           Bits 1 and 0        DTR Control Mode.
  1004.                     00 - Disable changing DTR during Open and Close.
  1005.                     01 - Enable Changing DTR during Open and Close.
  1006.                     10 - DTR used for input handshaking (not supported by
  1007.                          SIO).
  1008.                     11 - Invalid
  1009.  
  1010.           Bit 2,    Must be zero
  1011.           Bit 3,    Off to ignore CTS.  Forced on if RTS is handshake.
  1012.           Bit 4,    DSR is handshake.  Not supported by SIO.
  1013.           Bit 5,    DCD required to transmit.  Not supported by SIO.
  1014.           Bit 6,    DSR required to receive.
  1015.           Bit 7,    Must be zero.
  1016.  
  1017.      ─────────────────────────────────────
  1018.  
  1019.           "Flags2" is a bit flag.  The bits in the flag specify the
  1020.           following:
  1021.  
  1022.           Bit 0,    SIO is to honor Xon/XOff received from remote.
  1023.           Bit 1,    SIO may send Xon/Xoff to the remote.
  1024.           Bit 2,    Enable error replacement character.  Not supported by
  1025.                     SIO.
  1026.  
  1027.           Bit 3,    Enable null stripping.  Not supported by SIO.
  1028.           Bit 4,    Enable break replacement character.  Not supported by
  1029.                     SIO.
  1030.  
  1031.           Bit 5,    Enable Full duplex.  Half duplex is not supported by
  1032.                     SIO.
  1033.  
  1034.           Bits 7 and 6        RTS Control Mode
  1035.                     00 - Disable changing RTS during Open and Close.
  1036.                     01 - Enable Changing RTS during Open and Close.
  1037.                     10 - RTS used for input handshaking.
  1038.                     11 - Toggle on transmit (half duplex).  Not supported
  1039.                          by SIO.
  1040.  
  1041.  
  1042.  
  1043.  
  1044.                                                                          19
  1045.  
  1046.           "Flags3" is a bit flag.  The bits in the flag specify the
  1047.           following:
  1048.  
  1049.           Bit 0,    Enable infinite write timeout processing.  When set, a
  1050.                     write timeout will not occur.
  1051.  
  1052.           Bits 2 and 1        Read timeout processing
  1053.                     00 - Invalid.
  1054.                     01 - Normal read time out.
  1055.                     10 - Wait for something.  Reads will return before a
  1056.                          timeout occurs if something received.
  1057.                     11 - No Wait.  Reads will return immediately with any
  1058.                          available data.
  1059.  
  1060.           Bits 4 and 3        FIFO Control
  1061.                     00 - No change in FIFO state.
  1062.                     01 - Disable FIFO buffers.
  1063.                     10 - Enable FIFO buffers.
  1064.                     11 - Dynamic enabling and disabling of FIFOS.
  1065.  
  1066.                **Note, SIO forces bits 4 and 3 to "10".
  1067.  
  1068.           Bits 6 and 5        Set receive trigger level
  1069.                     00 - 1 character.
  1070.                     01 - 4 characters.
  1071.                     10 - 8 characters.
  1072.                     11 - 14 characters.
  1073.  
  1074.                **Note, SIO forces bits 6 and 5 to "10".
  1075.  
  1076.           Bit 7               Transmit load count
  1077.                     0 -  Load 1 character.
  1078.                     1 -  Load 16 characters.
  1079.  
  1080.                **Note, SIO forces bit 7 to "1".
  1081.  
  1082.           "Error Replacement Byte" Not supported by SIO.
  1083.  
  1084.           "Break Replacement Byte" Not supported by SIO
  1085.  
  1086.           "Xon Character" Any value, default is 11h.
  1087.  
  1088.           "Xoff Character" Any value, default is 13h.
  1089.  
  1090.      Data Packet - None
  1091.  
  1092.  
  1093.  
  1094.  
  1095.      20
  1096.  
  1097.  
  1098.                       54h - Write Extended Mode Parameters
  1099.  
  1100.      Parameter Packet
  1101.  
  1102.           ┌──────────────────────────────────────┐
  1103.           │         Item                Type     │
  1104.           ├───────────────────────────┬──────────┤
  1105.           │ Enhanced Flags1           │ BYTE     │
  1106.           ├───────────────────────────┼──────────┤
  1107.           │ Reserved                  │ DWORD    │
  1108.           └───────────────────────────┴──────────┘
  1109.  
  1110.           This function is not supported (ignored) by SIO.  However the
  1111.           bits are defined here for completeness.
  1112.  
  1113.           Enhanced Flags1
  1114.           Bit 0 -   Enhanced mode hardware available (Query only 74h).
  1115.           Bit 1 -   Enable enhanced mode.
  1116.           Bits 3 and 2        DMA Receive Operation
  1117.                00 - Disable DMA receive capability.
  1118.                01 - Enable DMA receive capability.
  1119.                10 - Dedicate a DMA channel to receive.
  1120.                11 - Reserved.
  1121.  
  1122.           Bits 5 and 4        DMA Transmit Operation
  1123.                00 - Disable DMA transmit capability.
  1124.                01 - Enable DMA transmit capability
  1125.                10 - Dedicate a DMA channel to transmit.
  1126.                11 - Reserved.
  1127.  
  1128.           Bit 6 -   Receive in DMA mode (Query only, 74h).
  1129.           Bit 7 -   Transmit in DMA mode (Query only, 74h).
  1130.  
  1131.      Data Packet - None.
  1132.  
  1133.  
  1134.  
  1135.  
  1136.                                                                          21
  1137.  
  1138.  
  1139.                           61h - Query Current Bit Rate
  1140.  
  1141.      Parameter Packet - None.
  1142.  
  1143.      Data Packet
  1144.  
  1145.           ┌──────────────────────────────────────┐
  1146.           │         Item                Type     │
  1147.           ├───────────────────────────┬──────────┤
  1148.           │ Bit/Baud Rate             │ WORD     │
  1149.           └───────────────────────────┴──────────┘
  1150.  
  1151.           See function 41h for more information.
  1152.  
  1153.  
  1154.                         62h - Query Line Characteristics
  1155.  
  1156.      Parameter Packet - None.
  1157.  
  1158.  
  1159.      Data Packet
  1160.  
  1161.  
  1162.           ┌──────────────────────────────────────┐
  1163.           │         Item                Type     │
  1164.           ├───────────────────────────┬──────────┤
  1165.           │ Data Bits Per Character   │ BYTE     │
  1166.           ├───────────────────────────┼──────────┤
  1167.           │ Parity Setting            │ BYTE     │
  1168.           ├───────────────────────────┼──────────┤
  1169.           │ Stop Bit Setting          │ BYTE     │
  1170.           ├───────────────────────────┼──────────┤
  1171.           │ Transmitting Break        │ BYTE     │
  1172.           └───────────────────────────┴──────────┘
  1173.  
  1174.           See function 42h for a definition of Data, Parity and Stop Bits.
  1175.  
  1176.           "Transmitting Break" is set to 1 if a break is being transmitted. 
  1177.           Otherwise, it is set to zero.
  1178.  
  1179.  
  1180.  
  1181.  
  1182.      22
  1183.  
  1184.  
  1185.                           63h - Query Extended Bit Rate
  1186.  
  1187.      Parameter Packet - None
  1188.  
  1189.  
  1190.      Data Packet
  1191.  
  1192.           ┌──────────────────────────────────────┐
  1193.           │         Item                Type     │
  1194.           ├───────────────────────────┬──────────┤
  1195.           │ Current Bit/Baud Rate     │ DWORD    │
  1196.           ├───────────────────────────┼──────────┤
  1197.           │ Fraction of Current       │ BYTE     │
  1198.           ├───────────────────────────┼──────────┤
  1199.           │ Minimum Bit/Baud Rate     │ DWORD    │
  1200.           ├───────────────────────────┼──────────┤
  1201.           │ Fraction of Minimum       │ BYTE     │
  1202.           ├───────────────────────────┼──────────┤
  1203.           │ Maximum Bit/Baud Rate     │ DWORD    │
  1204.           ├───────────────────────────┼──────────┤
  1205.           │ Fraction of Maximum       │ BYTE     │
  1206.           └───────────────────────────┴──────────┘
  1207.  
  1208.           "Current Bit/Baud Rate" is a 32 bit integer defining the current
  1209.           bit rate.
  1210.  
  1211.           "Fraction of Current" is always 0 when returned by SIO.
  1212.  
  1213.           "Minimum Bit/Baud Rate" is the minimum value that can be passed
  1214.           to SIO as a bit/baud rate.
  1215.  
  1216.           "Fraction of Minimum" is always 0 when returned by SIO. 
  1217.  
  1218.           "Maximum Bit/Baud Rate" is the maximum value that can be passed
  1219.           to SIO as a bit/baud rate.
  1220.  
  1221.           "Fraction of Maximum" is always 0 when returned by SIO.
  1222.  
  1223.  
  1224.  
  1225.  
  1226.                                                                          23
  1227.  
  1228.  
  1229.                              64h - Query SIO Status
  1230.  
  1231.      Parameter Packet - None
  1232.  
  1233.      Data Packet
  1234.  
  1235.           ┌──────────────────────────────────────┐
  1236.           │         Item                Type     │
  1237.           ├───────────────────────────┬──────────┤
  1238.           │ SIO Status Byte           │ BYTE     │
  1239.           └───────────────────────────┴──────────┘
  1240.  
  1241.           "SIO Status Byte" is a bit flag.  The bits have the following
  1242.           meanings:
  1243.  
  1244.           Bit 0 -   Set if SIO is waiting for CTS before transmitting.
  1245.           Bit 1 -   Set if SIO is waiting for DSR before transmitting.
  1246.           Bit 2 -   Set if SIO is waiting for DCD before transmitting.
  1247.           Bit 3 -   Set if SIO is waiting because Xoff received or
  1248.                     transmitter is disabled (see function 47h).
  1249.  
  1250.           Bit 4 -   Reserved, not used by SIO.
  1251.           Bit 5 -   Set if SIO is waiting because break is being sent.
  1252.           Bit 6 -   Set if a transmit immediate is pending.
  1253.           Bit 7 -   Reserved, not used by SIO.
  1254.  
  1255.  
  1256.  
  1257.  
  1258.      24
  1259.  
  1260.  
  1261.                         65h - Query Transmit Data Status
  1262.  
  1263.      Parameter Packet - None.
  1264.  
  1265.      Data Packet
  1266.  
  1267.           ┌──────────────────────────────────────┐
  1268.           │         Item                Type     │
  1269.           ├───────────────────────────┬──────────┤
  1270.           │ Transmit Status           │ BYTE     │
  1271.           └───────────────────────────┴──────────┘
  1272.  
  1273.           "SIO Status Byte" is a bit flag.  The bits have the following
  1274.           meanings:
  1275.  
  1276.           Bit 0 -   Set if write in progress or pending.
  1277.           Bit 1 -   Set if any data is in the transmit buffer.
  1278.           Bit 2 -   Set if UART is currently transmitting.
  1279.           Bit 3 -   Set if a transmit immediate is pending.
  1280.           Bit 4 -   Set if an Xon needs to be sent.
  1281.           Bit 5 -   Set if an Xoff needs to be sent.
  1282.           Bit 6 -   Reserved
  1283.           Bit 7 -   Reserved
  1284.  
  1285.  
  1286.  
  1287.  
  1288.                                                                          25
  1289.  
  1290.  
  1291.                 66h - Query Current Modem Output Control Signals
  1292.  
  1293.  
  1294.      Parameter Packet - None.
  1295.  
  1296.      Data Packet
  1297.  
  1298.           ┌──────────────────────────────────────┐
  1299.           │         Item                Type     │
  1300.           ├───────────────────────────┬──────────┤
  1301.           │ Modem Output Signals      │ BYTE     │
  1302.           └───────────────────────────┴──────────┘
  1303.  
  1304.           "Modem Output Signals" is a bit flag.  The bits have the
  1305.           following meanings:
  1306.  
  1307.           Bit 0 -   Set if DTR is currently on.
  1308.           Bit 1 -   Set if RTS is currently on.
  1309.           Bits 2-7  Reserved, set to zero by SIO.
  1310.  
  1311.  
  1312.                      67h - Query Current Modem Input Signals
  1313.  
  1314.      Parameter Packet - None.
  1315.  
  1316.      Data Packet
  1317.  
  1318.           ┌──────────────────────────────────────┐
  1319.           │         Item                Type     │
  1320.           ├───────────────────────────┬──────────┤
  1321.           │ Modem Input Signals       │ BYTE     │
  1322.           └───────────────────────────┴──────────┘
  1323.  
  1324.           "Modem Output Signals" is a bit flag.  The bits have the
  1325.           following meanings:
  1326.  
  1327.           Bits 0-3  Reserved, set to zero by SIO.
  1328.           Bit 4 -   Clear To Send (CTS) is active.
  1329.           Bit 5 -   Data Set Ready (DSR) is active.
  1330.           Bit 6 -   Ring Indicator (RI), trailing edge detected.
  1331.           Bit 7 -   Data Carrier Detect (DCD) is active.
  1332.  
  1333.  
  1334.  
  1335.  
  1336.      26
  1337.  
  1338.  
  1339.                68h - Query Number of Characters in Receive Buffer
  1340.  
  1341.      Parameter Packet - None.
  1342.  
  1343.      Data Packet
  1344.  
  1345.           ┌──────────────────────────────────────┐
  1346.           │         Item                Type     │
  1347.           ├───────────────────────────┬──────────┤
  1348.           │ Number of Bytes Buffered  │ WORD     │
  1349.           ├───────────────────────────┼──────────┤
  1350.           │ Byte Size of the Buffer   │ WORD     │
  1351.           └───────────────────────────┴──────────┘
  1352.  
  1353.           Self explaining.
  1354.  
  1355.  
  1356.                69h - Query Number of Characters in Transmit Buffer
  1357.  
  1358.      Parameter Packet - None.
  1359.  
  1360.      Data Packet
  1361.  
  1362.           ┌──────────────────────────────────────┐
  1363.           │         Item                Type     │
  1364.           ├───────────────────────────┬──────────┤
  1365.           │ Number of Bytes Buffered  │ WORD     │
  1366.           ├───────────────────────────┼──────────┤
  1367.           │ Byte Size of the Buffer   │ WORD     │
  1368.           └───────────────────────────┴──────────┘
  1369.  
  1370.           Self explaining.
  1371.  
  1372.  
  1373.  
  1374.  
  1375.                                                                          27
  1376.  
  1377.  
  1378.                               6Dh - Query SIO Error
  1379.  
  1380.  
  1381.      Parameter Packet - None.
  1382.  
  1383.      Data Packet
  1384.  
  1385.           ┌──────────────────────────────────────┐
  1386.           │         Item                Type     │
  1387.           ├───────────────────────────┬──────────┤
  1388.           │ SIO Error Word            │ WORD     │
  1389.           └───────────────────────────┴──────────┘
  1390.  
  1391.           "SIO Error Word" is a bit flag.  The bits have the following
  1392.           meaning:
  1393.  
  1394.           Bit 0 -   Set if a buffer overrun has occurred.
  1395.           Bit 1 -   Set if an overrun occurred at the UART.
  1396.           Bit 2 -   Set if the UART detected a parity error.
  1397.           Bit 3 -   Set if the UART detected a framing error.
  1398.           Bits 4-15 Reserved, set to zero by SIO.
  1399.  
  1400.           All bits of the SIO Error Word are reset prior to returning to
  1401.           the caller.
  1402.  
  1403.  
  1404.  
  1405.  
  1406.      28
  1407.  
  1408.  
  1409.                         72h - Query SIO Event Information
  1410.  
  1411.      Parameter Packet - None.
  1412.  
  1413.      Data Packet
  1414.  
  1415.           ┌──────────────────────────────────────┐
  1416.           │         Item                Type     │
  1417.           ├───────────────────────────┬──────────┤
  1418.           │ SIO Event Word            │ WORD     │
  1419.           └───────────────────────────┴──────────┘
  1420.  
  1421.           "SIO Event Word" is a bit flag.  The bits have the following
  1422.           meaning:
  1423.  
  1424.           Bit 0 -   Set when a receive character is transferred from the
  1425.                     UART to the receive buffer.
  1426.           Bit 1 -   Set when a receive (Read) timeout occurs.
  1427.           Bit 2 -   Set if the transmit buffer is empty.
  1428.           Bit 3 -   Set if Clear To Send (CTS) has changed state.
  1429.           Bit 4 -   Set if Data Set Ready (DSR) has changed state.
  1430.           Bit 5 -   Set if Data Carrier Detect (DCD) has changed state.
  1431.           Bit 6 -   Set if a break has been detected.
  1432.           Bit 7 -   Set if a framing, parity, or overrun error has
  1433.                     occurred.
  1434.           Bit 8 -   Set if trailing edge of Ring Indicator (RI) has
  1435.                     occurred.
  1436.           Bits 9-15 Reserved, set to zero by SIO.
  1437.  
  1438.           All bits are reset prior to returning to the caller.
  1439.  
  1440.  
  1441.  
  1442.  
  1443.                                                                          29
  1444.  
  1445.  
  1446.                       73h - Read Device Control Block (DCB)
  1447.  
  1448.      Parameter Packet - None.
  1449.  
  1450.  
  1451.      Data Packet
  1452.  
  1453.           ┌──────────────────────────────────────┐
  1454.           │         Item                Type     │
  1455.           ├───────────────────────────┬──────────┤
  1456.           │ Write Timeout             │ WORD     │
  1457.           ├───────────────────────────┼──────────┤
  1458.           │ Read Timeout              │ WORD     │
  1459.           ├───────────────────────────┼──────────┤
  1460.           │ Flags1                    │ BYTE     │
  1461.           ├───────────────────────────┼──────────┤
  1462.           │ Flags2                    │ BYTE     │
  1463.           ├───────────────────────────┼──────────┤
  1464.           │ Flags3                    │ BYTE     │
  1465.           ├───────────────────────────┼──────────┤
  1466.           │ Error Replacement Byte    │ BYTE     │
  1467.           ├───────────────────────────┼──────────┤
  1468.           │ Break Replacement Byte    │ BYTE     │
  1469.           ├───────────────────────────┼──────────┤
  1470.           │ Xon Character             │ BYTE     │
  1471.           ├───────────────────────────┼──────────┤
  1472.           │ Xoff Character            │ BYTE     │
  1473.           └───────────────────────────┴──────────┘
  1474.  
  1475.           See function 53h for a description of the parameters.
  1476.  
  1477.  
  1478.                        74h - Read Enhanced Mode Parameters
  1479.  
  1480.      Parameter Packet - None.
  1481.  
  1482.      Data Packet
  1483.  
  1484.           ┌──────────────────────────────────────┐
  1485.           │         Item                Type     │
  1486.           ├───────────────────────────┬──────────┤
  1487.           │ Enhanced Flags1           │ BYTE     │
  1488.           ├───────────────────────────┼──────────┤
  1489.           │ Reserved                  │ DWORD    │
  1490.           └───────────────────────────┴──────────┘
  1491.  
  1492.           See function 54h for a description of the Flags1 Byte.
  1493.  
  1494.  
  1495.  
  1496.  
  1497.      30
  1498.  
  1499.                     Differences between SIO/VSIO and COM/VCOM
  1500.      What follows is some of the differences between SIO/VSIO and COM/VCOM
  1501.      that are known to the author.
  1502.  
  1503.      1 -  COM.SYS will automatically seek out and support four comm
  1504.           ports, COM1 through COM4.  SIO.SYS will automatically seek
  1505.           out and support only COM1 and COM2.  If SIO.SYS is to
  1506.           support more than two comm ports, they must be defined in
  1507.           the command line that loads SIO.SYS.  For example,
  1508.           DEVICE=SIO.SYS (COM3) (COM4) will cause SIO.SYS to support
  1509.           four comm ports.
  1510.  
  1511.      2 -  In the absence of overrides in the command line, COM.SYS
  1512.           will seek out four comm ports in the sequence of I/O ports
  1513.           3F8h, 2F8h, 3E8h and 2E8h.  The first port found in this
  1514.           sequence is given the logical name COM1, the second is COM2
  1515.           etc.  This means that the comm port at 2F8h could become
  1516.           COM1.  In the opinion of the author, this confuses some
  1517.           users to frustration.
  1518.  
  1519.           With no command line overrides, SIO.SYS uses a fixed I/O
  1520.           port concept.  That is, COM1 is always at I/O port 3F8h,
  1521.           COM2 is always at 2F8h, etc.  Another way of looking at this
  1522.           is;  if no comm port exists at port 3F8h, then you do not
  1523.           have a COM1.  SIO.SYS will not move another (found) comm
  1524.           port into the logical COM1 slot.
  1525.  
  1526.      3 -  VSIO opens a comm port for a DOS session with sharing allowed. 
  1527.           VCOM uses an "exclusive use" open for DOS sessions.
  1528.  
  1529.      4 -  SIO.SYS will accept any number from 50 up as a valid baud rate. 
  1530.           For example, if an application program attempts to set a baud
  1531.           rate of 9990 bps, COM.SYS will reject it and SIO.SYS will accept
  1532.           it.
  1533.  
  1534.      5 -  SIO/VSIO execute faster than COM/VCOM.  This means that some
  1535.           applications, that are timing dependent, may not work under
  1536.           SIO/VSIO that do work under COM/VCOM.
  1537.  
  1538.      6 -  SIO/VSIO provides more reliable active flow control for DOS
  1539.           sessions.  For example, if RTS/CTS handshaking is in use, VSIO
  1540.           virtualizes the RTS settings by the DOS program while SIO
  1541.           completely controls the real RTS signal.  COM/VCOM simply passes
  1542.           the RTS signal directly to the hardware.
  1543.  
  1544.      7 -  COM.SYS will block an application until a write completes.  SIO
  1545.           will return to the application program immediately if all of the
  1546.           write data will fit into SIO's internal buffers.
  1547.  
  1548.  
  1549.  
  1550.  
  1551.                                                                          31
  1552.  
  1553.                   Appendix A, Hardware Port and IRQ Assignments
  1554.  
  1555.      I have obtained the following information from various sources. 
  1556.      Accuracy is not guaranteed.  In fact, nothing in this document is
  1557.      guaranteed.
  1558.  
  1559.      Addresses and IRQs for COM1 and COM2
  1560.  
  1561.           COM1 uses 03F8h and IRQ4
  1562.           COM2 uses 02F8h and IRQ3
  1563.  
  1564.      Defacto standard for COM3 and COM4 for PC, XT and AT
  1565.  
  1566.           COM3 uses 03E8h and IRQ4
  1567.           COM4 uses 02E8h and IRQ3
  1568.  
  1569.      Addresses and IRQ for COM3 through COM8 on the PS/2
  1570.  
  1571.           COM3 uses 3220h and IRQ3
  1572.           COM4 uses 3228h and IRQ3
  1573.           COM5 uses 4220h and IRQ3
  1574.           COM6 uses 4228h and IRQ3
  1575.           COM7 uses 5220h and IRQ3
  1576.           COM8 uses 5228h and IRQ3
  1577.  
  1578.      All PCs (known to the author) prior to the PS/2 and EISA only use 10
  1579.      bits to address hardware I/0 ports.  Systems prior to the PS/2 and
  1580.      EISA can not address the standard PS/2 addresses for COM3 through
  1581.      COM8.  If an AT or below attempts to address COM3 through COM8 using
  1582.      the PS/2 addresses, only the low 10 bits of the address are used. 
  1583.      That is, the high 6 bits of the address will be ignored by the
  1584.      hardware.  This means that any reference to COM3 through COM8 will
  1585.      actually address ports 220h through 22Fh on older PCs.
  1586.  
  1587.      One should avoid expansion boards that use ports 220h through 22Fh
  1588.      unless the expansion board is a serial I/O board. 
  1589.  
  1590.      SIO will (attempt to) determine the hardware architecture (ISA/EISA
  1591.      and PS/2) that it is being executed on and use the appropriate
  1592.      hardware port addresses for COM1 thru COM4 as defaults.
  1593.  
  1594.  
  1595.  
  1596.  
  1597.      32
  1598.  
  1599.                               Appendix B, SIO Chips
  1600.  
  1601.  
  1602.      The following is a collection of comments developed from hearsay,
  1603.      random documents, experience, and technical specifications. So, take
  1604.      it with a grain of salt.  Order information from the various
  1605.      manufactures if you want accurate information.
  1606.  
  1607.      Very good reference books are available from National Semiconductor
  1608.      Corporation.  They cover most of the SIO devices (also called UARTs)
  1609.      that you will find in many PCs and clones.  I am not sure that books
  1610.      can be ordered directly from National Semiconductor. They may require
  1611.      that you get it from a distributor.  In any case, the address on the
  1612.      back of the one manual is:
  1613.  
  1614.           National Semiconductor Corporation
  1615.           2900 Semiconductor Drive
  1616.           P.O. Box 58090
  1617.           Santa Clara, CA 95052-8090
  1618.  
  1619.           Tel:(408)721-5000
  1620.           TWX:(910)339-9240
  1621.  
  1622.      8250
  1623.  
  1624.      As best I known, the 8250 was the first SIO chip (integrated circuit)
  1625.      that was used by the IBM PC and many clones.  In my opinion, it was a
  1626.      poor choice on the part of IBM.  I feel many superior devices, at
  1627.      comparable prices, were readily available.  At that time, I feel the
  1628.      8251A or the 8530 would have been better choices.  But, they used the
  1629.      8250 and therefore we must use it.
  1630.  
  1631.      From a hardware standpoint the 8250 is a relatively slow device.  It
  1632.      is advisable that programmers not perform successive inputs or outputs
  1633.      to this device.  It seems that software programs can load the various
  1634.      registers of the 8250 faster than it can process the information.  The
  1635.      8250 had a total of 7 registers.  The specifications state that 56kb
  1636.      is the maximum baud rate.
  1637.  
  1638.      8250A
  1639.  
  1640.      I believe the 8250A is the 8250 with some bug fixes.  I have no idea
  1641.      what the bugs may have been.  A quick glance at the specifications
  1642.      shows the speed of the 8250 and 8250A to be much the same.  The 8250A
  1643.      added an 8th register.  This additional register enables software to
  1644.      detect if an 8250 is installed.  The specifications state that 56kb is
  1645.      the maximum baud rate.
  1646.  
  1647.  
  1648.  
  1649.  
  1650.                                                                          33
  1651.  
  1652.      16450
  1653.  
  1654.      The 16450 seems to be a speeded up version of the 8250A.  There is no
  1655.      direct way (that I know of) for software to detect the difference
  1656.      between an 8250A and a 16450.  I believe the 16450 was developed to
  1657.      eliminate the need for software to insert delays between successive
  1658.      accesses to the device.  The specifications indicate the 16450 is a
  1659.      much faster device than its predecessors.  The additional speed is
  1660.      only the speed at which the processor can access the device.  The
  1661.      maximum baud rate for the 16450 is still stated at 56kb.  However, I
  1662.      have been told by some people that they have run the 16450
  1663.      successfully at much higher speeds. I do not believe there was ever a
  1664.      16450A.
  1665.  
  1666.      16C451
  1667.  
  1668.      The 16C451 is a CMOS version of the 16450.  CMOS is a term for the
  1669.      material and manufacturing process used to make the part.  CMOS
  1670.      typically uses less power than other technologies.  If you are not
  1671.      designing hardware, you should view the 16C451 as a 16450.
  1672.  
  1673.      16550 (Non A)
  1674.  
  1675.      It is hard to find a 16550 (Non A).  I was told by National
  1676.      Semiconductor that they did everything they could to get all 16550s
  1677.      back.  SIO will detect a 16550 and tell you if you have one.  I am
  1678.      told that the 16550 was installed in early PS/2 systems.
  1679.  
  1680.      The 16550 was the first shot at a FIFOed version of the 8250 family
  1681.      from National semiconductor.  However, I was told by National
  1682.      Semiconductor that the FIFOs of the 16550 are not reliable and they
  1683.      should not be enabled.  SIO will treat a 16550 like a 16450.  In this
  1684.      mode, they are reliable.  National Semiconductor would not provide me
  1685.      with a specification for the 16550.  However, I suspect its maximum
  1686.      baud rate is the same as the 16550A which is 256kb.
  1687.  
  1688.      16550A, 16550AF and 16550AFN
  1689.  
  1690.      In the manuals that I have, National Semiconductor does not explain
  1691.      the differences between the 16550A and the 16550AF.  I suspect the AF
  1692.      part may have a few bug fixes.  I believe the N in AFN describes
  1693.      packaging, ceramic versus plastic, DIP versus surface mount etc.
  1694.  
  1695.      In the opinion of the author, there is no substitute for the 16550A
  1696.      (and its successors) in the 8250 type series.  The 16550A is
  1697.      compatible with most software written for the entire family of 8250
  1698.      type devices.  Programs that are 16550A aware can provide much
  1699.      improved performance over previous devices.
  1700.  
  1701.  
  1702.      The maximum baud rate for the 16550A is specified at 256kb.  However,
  1703.      due to the hardware design of the PC et al, 115kb is the maximum baud
  1704.      rate that can be programmed by software.
  1705.  
  1706.      The 16550A can be plugged into the same socket that contains an 8250,
  1707.  
  1708.  
  1709.  
  1710.  
  1711.      34
  1712.  
  1713.      8250A or 16450.  If your SIO expansion board has the SIO chips in
  1714.      sockets, you can upgrade to the 16550A by simply removing the old
  1715.      chips and replacing them with 16550As.
  1716.  
  1717.      The key to the performance increase of the 16550A is its FIFOs.  It
  1718.      has 16 byte FIFOs for both transmit and receive data.
  1719.  
  1720.      16550s Made by Western Digital
  1721.  
  1722.      I have been told, but I have not verified for myself, that 16550s made
  1723.      by Western Digital have a problem with their FIFOs when working at
  1724.      2400 baud or below.
  1725.  
  1726.      16C551
  1727.  
  1728.      The 16C551 is a CMOS version of the 16550AF.  See the above
  1729.      description of the 16C451 for a discussion of CMOS.  Do not feel you
  1730.      need to upgrade from a 16550A or AF to a 16C551.  There is no gain
  1731.      from an existing users point of view.
  1732.  
  1733.      16C552
  1734.  
  1735.      The 16C552 is two 16C551s on a single chip.
  1736.  
  1737.      16C554
  1738.  
  1739.      The 16C554 is four 16C551s on a single chip.
  1740.  
  1741.      82510
  1742.  
  1743.      I believe Intel is the only company that manufactures the 82510.  The
  1744.      82510 is feature rich with several modes of operation.  Its default
  1745.      mode is to operate as a 16450.  The 82510 has a 4 byte FIFO for both
  1746.      transmit and receive data.  A 4 byte FIFO is sufficient to provide
  1747.      significant performance over a basic 16450.
  1748.  
  1749.      The 82510 is small in size.  Therefore, it is found in many lap tops.
  1750.  
  1751.      The 82510 is somewhat of a sleeper.  I believe it would be much more
  1752.      widely used if Intel had promoted it more.  However, given a choice
  1753.      between the 82510 and the 16550A, I would select the 16550A.
  1754.  
  1755.  
  1756.  
  1757.  
  1758.                                                                          35
  1759.  
  1760.  
  1761.      16650
  1762.  
  1763.      The 16650 by Startech seems a good logical step in the evolution of
  1764.      the 8250 type UARTs.  One of the many flavors of the 16650 is a
  1765.      package that is pin compatible with the 40 pin (DIP) 16550s.  This
  1766.      means that the 16650 can be placed into the same socket as any 16550,
  1767.      8250, etc.
  1768.  
  1769.      The 16650 has enhanced the FIFOs to 32 bytes, added on chip flow
  1770.      control ability, and increases the maximum bit rate to 460800.  The on
  1771.      chip flow control is a really nice feature.  On chip flow control
  1772.      practically eliminates the possibility of missed receive characters. 
  1773.      On chip flow control also means that some devices that require
  1774.      immediate attention when it sends Xoff, like the Seiko Label Printer,
  1775.      will work much better in environments like OS/2 and Windows.
  1776.  
  1777.      The 32 byte FIFOs of the 16650 is an improvement over the 16550, but
  1778.      is still a disappointment.  I feel that 1k, or larger, FIFOs would
  1779.      have been a much better choice.  When I quizzed Startech about this,
  1780.      they replied that the 32 byte FIFOs were chosen to keep the cost down. 
  1781.      They added that if the 16650 is successful, they plan a 16750 with
  1782.      larger FIFOs.
  1783.  
  1784.      The 16650 powers up in a 16550 compatible mode, meaning most software
  1785.      written for the 16550 should work.  I have discovered a serious
  1786.      incompatibility in the current (Oct 1994) versions of the 16650.  All
  1787.      previous UARTS in the 8250 family will issue only a single transmit
  1788.      interrupt if no additional data is sent to the UART.  The 16650 on the
  1789.      other hand, will issue continuous transmit interrupts making it
  1790.      necessary to mask the transmit interrupt.  I quizzed Startech about
  1791.      this and was told that a new revision of the chip would be available
  1792.      within a few months that would correct this incompatibility.
  1793.  
  1794.  
  1795.  
  1796.  
  1797.      36
  1798.  
  1799.  
  1800.      ComBic
  1801.  
  1802.      The ComBic is a very impressive UART used on the Hayes ESP card and
  1803.      some others.  The ComBic is basically a 16550 UART with on chip flow
  1804.      control and 1k FIFOs and a maximum bit rate of 921600.   Like the
  1805.      16650, on chip flow control practically eliminates the possibility of
  1806.      missed receive characters.  On chip flow control also means that some
  1807.      devices that require immediate attention when it sends Xoff, like the
  1808.      Seiko Label Printer, will work much better in environments like OS/2
  1809.      and Windows.
  1810.  
  1811.      The ComBic has two modes of operation, compatibility mode and enhanced
  1812.      mode.  In compatibility mode, the UART acts as a 16550.  However, when
  1813.      in compatibility mode, the 1k FIFOs and on chip flow control can still
  1814.      be used.  In enhanced mode, software gains the ability to look into
  1815.      the FIFOs and determine the exact number of bytes loaded.  This
  1816.      feature enables software the use block input and output to the ComBic
  1817.      which greatly reduces processor overhead.
  1818.  
  1819.  
  1820.  
  1821.  
  1822.                                                                          37
  1823.  
  1824.                      Appendix C, Multi-Port Serial I/0 Cards
  1825.  
  1826.      I have received many requests for information about multi-port serial
  1827.      I/O card.  I will describe the boards that I know about (or have heard
  1828.      about) here.  I will add to the list as I receive precise information
  1829.      from manufactures, users, or I develop it myself.
  1830.  
  1831.      STB 4COM  (ISA bus)
  1832.  
  1833.      I am very impressed with the STB 4COM card, they have almost got it. 
  1834.      Yes, it's the same company that makes the VGA cards.  The 4COM card
  1835.      uses a 16554 which is the equivalent of four 16550A.  Comm ports can
  1836.      use IRQs 2/9, 3, 4, 5, 10, 11, 12, and 15.  Any or all ports can share
  1837.      IRQs, and they have done this right.  I tested SIO with all four ports
  1838.      of the 4COM on IRQ12 and they worked correctly.  The user can select
  1839.      any of the following I/O port address for a comm port: 3F8, 2F8, 3E8,
  1840.      2E8, 1A8, 1E8, 1F8, 2A8.
  1841.  
  1842.      The 4COM card is priced at $110 and I ordered mine from Prerapture
  1843.      Solutions which can be reached by telephone at 1-919-286-1502 for
  1844.      information and foreign callers.  In the US orders can be placed by
  1845.      calling 1-800-735-5266.  Their mailing address is:
  1846.           Prerapture Solutions
  1847.           1806 Albany St.
  1848.           Durham NC 27705-3135
  1849.  
  1850.      Gtek BBS550 (ISA bus)
  1851.  
  1852.      The Gtek BBS550 is a communications card with the equivalent of 8
  1853.      16550s (in reality two 16554s) UARTS.  Where were these cards 5 years
  1854.      ago!  Like the STB 4COM, I am very impressed with the BBS550.  It has
  1855.      a wide range of selectable I/O port address, some in the 16 bit range
  1856.      (above 3FFh) which can be very useful.  I tested the board with all 8
  1857.      ports installed using IRQ3 (although I never had more than 3 ports
  1858.      active at the same time).  The board performed well using shared IRQs.
  1859.  
  1860.      The BBS550 has 8 RJ-45 connectors (10 pin), 6 of which comes directly
  1861.      off the back of the card.  The other two RJ-45 connectors are internal
  1862.      and special cables with grommets are supplier for these 2 ports.  The
  1863.      cables supplied with the BBS550 expands the RJ-45 out to standard DB-
  1864.      25 connectors.
  1865.  
  1866.      Gtek is located in St. Louis Mississippi.  Their phone number is 800-
  1867.      282-4835 or 601-467-8048.
  1868.  
  1869.      Neotech Quad Serial (MCA bus)
  1870.  
  1871.      Well, I just got my first PS/2 system (for testing of SIO) and I am
  1872.      using the NeoTech Quad Serial card in that system.  What can I say, it
  1873.      works beautifully and interrupt sharing has never been a problem on
  1874.      MCA systems.  This card (as shipped) came with four individual 16450
  1875.      chips installed, but they were in sockets so I installed 16550 UARTS
  1876.      before I installed the card.  The card has one large connector on the
  1877.      back of the card and the supplied cable expands that to 4 standard DB-
  1878.      25 connectors.  Those of you needing a 4 port card for an MCA system
  1879.  
  1880.  
  1881.  
  1882.  
  1883.      38
  1884.  
  1885.      contact:
  1886.  
  1887.           Neotech Inc
  1888.           30295 Solon Industrial Pkwy.
  1889.           Solon, Ohio 44139
  1890.  
  1891.           Voice     (216) 248-4114
  1892.           FAX       (216) 248-5701
  1893.  
  1894.  
  1895.  
  1896.  
  1897.                                                                          39
  1898.  
  1899.                         Appendix D, Advanced SIO Options
  1900.  
  1901.  
  1902.      The following is provided for the experienced user.  Inexperienced
  1903.      users get themselves into a lot of trouble when trying to use these
  1904.      options and they cause an inordinate number of support problems.
  1905.      Therefore, the following are unsupported options.  If you use them,
  1906.      you must work out the problems yourself or ask a friend how they got
  1907.      it working.
  1908.  
  1909.      Protection
  1910.  
  1911.      Placing a dash "-" in the fourth parameter position, eg
  1912.      (COM1,3F8,IRQ4,-),  causes SIO not to provide any protection for that
  1913.      port.  The OS may still protect the port somewhat.  When the dash
  1914.      parameter is used the port is wide open (like DOS) for any process to
  1915.      access it.
  1916.  
  1917.      Locked Baud Rate
  1918.  
  1919.      Placing a colon and a baud rate following the communications port, eg
  1920.      (COM1:38400,3F8,IRQ4), causes the port to be locked at that baud rate. 
  1921.      No program, OS2 or DOS, is allowed to change the baud rate.
  1922.  
  1923.      IRQ Reflection to DOS Process
  1924.  
  1925.      Normally the IRQ that is reflected to a DOS process is the same as the
  1926.      actual hardware IRQ.  Placing a colon and an additional IRQ following
  1927.      the normal IRQ, eg (COM1,3F8,IRQ12:IRQ4), causes SIO/VSIO to reflect
  1928.      the IRQ to a DOS process on IRQ4 (in this example) even though the
  1929.      real hardware IRQ is IRQ12.  If one wishes SIO to automatically locate
  1930.      the hardware IRQ, then the following construct can be used:
  1931.      (COM1,3F8,:IRQ4).  Notice that the hardware IRQ is simply NOT
  1932.      specified.
  1933.  
  1934.      I/O Port Mapping to DOS Process
  1935.  
  1936.      Some DOS programs, such as CompuServe's CIM, insist that COM1 be at
  1937.      I/O port 03F8, COM2 at 02F8, etc.  On OS/2 systems, comm ports can
  1938.      have any I/O port address as specified by a command line.  If COM1 is
  1939.      not at I/O port 03F8 for some DOS programs, then COM1 can not be used
  1940.      by the DOS program.  The SIO command line allows the I/O ports to be
  1941.      mapped to a different address for DOS sessions, eg
  1942.      (COM1,FF80:03F8,IRQ12:IRQ4).  In this example, the real COM1 is at
  1943.      FF80 on IRQ12, but is reflected to DOS processes on I/O ports 03F8 at
  1944.      IRQ4.  It is NOT necessary to map both the I/O port address and the
  1945.      IRQ.  When the I/O port is mapped to a DOS session, the UART will
  1946.      appear at BOTH I/O port addresses (FF80 and 03F8 in the given
  1947.      example).
  1948.  
  1949.  
  1950.  
  1951.  
  1952.      40
  1953.  
  1954.                                       Index
  1955.  
  1956.      16450 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  1957.      16550 (Non A) . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  1958.      16550A  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  1959.      16550AF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  1960.      16550AFN  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  1961.      16550s Made by Western Digital  . . . . . . . . . . . . . . . . . . 34
  1962.      16650 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  1963.      16C451  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  1964.      16C551  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  1965.      16C552  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  1966.      16C554  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  1967.      8250  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  1968.      8250A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  1969.      82510 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  1970.      Additional Open . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  1971.      Addresses and IRQ for COM3 through COM8 on the PS/2 . . . . . . . . 31
  1972.      Addresses and IRQs for COM1 and COM2  . . . . . . . . . . . . . . . 31
  1973.      Appendix A, Hardware Notes  . . . . . . . . . . . . . . . . . . . . 31
  1974.      Appendix B, SIO Chips . . . . . . . . . . . . . . . . . . . . . . . 32
  1975.      Appendix C, Multi-Port Serial I/0 Cards . . . . . . . . . . . . . . 37
  1976.      Appendix D, Advanced SIO Options  . . . . . . . . . . . . . . . . . 39
  1977.      BBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  1978.      Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  1979.      ComBic  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  1980.      CompuServe  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  1981.      DCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6-8
  1982.      Defacto standard for COM3 and COM4  . . . . . . . . . . . . . . . . 31
  1983.      Development and Debugging Tools . . . . . . . . . . . . . . . . . .  4
  1984.      Device Control Block  . . . . . . . . . . . . . . . . . . . . . . .  8
  1985.      Differences between SIO/VSIO and COM/VCOM . . . . . . . . . . . . . 30
  1986.      Distribution  . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  1987.      Driver Initialization . . . . . . . . . . . . . . . . . . . . . . .  6
  1988.      DTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  1989.      DTR Control Mode  . . . . . . . . . . . . . . . . . . . . . . . . .  8
  1990.      Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  1991.      Extended Set Bit Rate . . . . . . . . . . . . . . . . . . . . . . . 13
  1992.      FAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  1993.      FIFO  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33, 34
  1994.      File System Requests  . . . . . . . . . . . . . . . . . . . . . . .  6
  1995.      First Level Open  . . . . . . . . . . . . . . . . . . . . . . . . .  7
  1996.      Gtek BBS550 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  1997.      Hold Transmit . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
  1998.      I/O Port Mapping to DOS Process . . . . . . . . . . . . . . . . . . 39
  1999.      Initial Open  . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2000.      Input Flush . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2001.      Input Status  . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  2002.      Intermediate Close  . . . . . . . . . . . . . . . . . . . . . . . .  8
  2003.      IRQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2004.      IRQ Reflection to DOS Process . . . . . . . . . . . . . . . . . . . 39
  2005.      Last Close  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2006.      Locked Baud Rate  . . . . . . . . . . . . . . . . . . . . . . . . . 39
  2007.      National Semiconductor Corporation  . . . . . . . . . . . . . . . . 32
  2008.      Neotech Quad Serial . . . . . . . . . . . . . . . . . . . . . . . . 37
  2009.  
  2010.  
  2011.  
  2012.  
  2013.                                                                          41
  2014.  
  2015.      Open  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2016.      Ordering  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2017.      OS2BVEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2018.      Output Flush  . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2019.      Output Status . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2020.      PMLM.EXE  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  2021.      Protection  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
  2022.      Query Current Bit Rate  . . . . . . . . . . . . . . . . . . . . . . 21
  2023.      Query Current Modem Input Signals . . . . . . . . . . . . . . . . . 25
  2024.      Query Current Modem Output Control Signals  . . . . . . . . . . . . 25
  2025.      Query Extended Bit Rate . . . . . . . . . . . . . . . . . . . . 13, 22
  2026.      Query Line Characteristics  . . . . . . . . . . . . . . . . . . . . 21
  2027.      Query Number of Characters in Receive Buffer  . . . . . . . . . . . 26
  2028.      Query Number of Characters in Transmit Buffer . . . . . . . . . . . 26
  2029.      Query SIO Error . . . . . . . . . . . . . . . . . . . . . . . . . . 27
  2030.      Query SIO Event Information . . . . . . . . . . . . . . . . . . . . 28
  2031.      Query SIO Status  . . . . . . . . . . . . . . . . . . . . . . . . . 23
  2032.      Query Transmit Data Status  . . . . . . . . . . . . . . . . . . . . 24
  2033.      Read  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  2034.      Read Device Control Block (DCB) . . . . . . . . . . . . . . . . . . 29
  2035.      Read Enhanced Mode Parameters . . . . . . . . . . . . . . . . . . . 29
  2036.      RTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2037.      RTS Control Mode  . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2038.      Set Bit Rate  . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  2039.      Set Break Off . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
  2040.      Set Break on  . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  2041.      Set Line Characteristics  . . . . . . . . . . . . . . . . . . . . . 12
  2042.      Set Modem Control Signals . . . . . . . . . . . . . . . . . . . . . 15
  2043.      SIO Chips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  2044.      SIO's Utility (SU.EXE)  . . . . . . . . . . . . . . . . . . . . . .  5
  2045.      Start Transmit  . . . . . . . . . . . . . . . . . . . . . . . . . . 16
  2046.      STB 4COM  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  2047.      Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2048.      Transmit Byte Immediate . . . . . . . . . . . . . . . . . . . . . . 14
  2049.      UART  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  2050.      Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  2051.      VIEWPMLM.EXE  . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
  2052.      WHAT IS SIO . . . . . . . . . . . . . . . . . . . . . . . . . . . .  1
  2053.      Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2054.      Write Device Control Block (DCB)  . . . . . . . . . . . . . . . . . 17
  2055.      Write Extended Mode Parameters  . . . . . . . . . . . . . . . . . . 20
  2056.